Apple // Typewriter
By Grant Kwai
Copyright (c) 1991 Apple Users' Group, Sydney
Republished from Applecations, a publication of the Apple Users' Group, Sydney, Australia.
Have you ever wanted to print something short and sweet, like the address on an envelope, but could not be bothered firing up the word processor? This program is an ideal solution.
Below is a 'quick and dirty' routine which will allow you to input a line of text and print it to your dot matrix printer.
This program will print a line of text upon one of three occasions:
- You press return
- You press the backspace key (left arrow)
- 80 characters have been entered
You will notice that if you make an error and try to backspace, the printer will print what you have typed so far but will not issue a carriage return. The printer will backspace happily over the text. This means that you can have two characters on the same position. Sorry, no lift-off!
However, you can take advantage of the above 'problem' by retyping what you originally typed. This will give you an emphasized image.
In developing this program, I encountered two different types of printer cards. One type allows you to see what you print even after you have typed 'PR#1', while others just give you a blank screen and you have to guess what you are typing. You will need to experiment to find out what your printer does for the program to behave as expected.
This program has been designed to work under ProDOS only. To make it work under DOS 3.3, change wherever you see 'PR#A$C307' to POKE 54,7 : POKE 55,195:CALL 1002. What this does is keep the 80 column screen intact on 'PR#0'.
For those who own a modem, I have uploaded this program onto the AUG Apple // BBS.
Listing
-------
1 REM ------------------------------
2 REM - This program is freeware -
3 REM - Please give it to all your -
4 REM - friends. -
5 REM - TCT is by -
6 REM - Grant Kwai, 1990 -
7 REM ------------------------------
8 REM
10 PRINT CHR$(4);"PR#3"
20 PRINT SPC(28); "The Computer Typewriter"
30 PRINT SPC(31); "BY Grant Kwai,1990"
40 VTAB 5:PRINT "This is a small program which will allow you to print to your printer as though it were a typewriter."
50 PRINT "Make sure your printer is turned ON now."
60 PRINT "When you normally type 'PR#1', can you see what you type on the computer screen? (Y/N)": GET A$
70 IF A$ = "N" OR A$= "n" THEN LET OTH = 1
75 REM PRINTING TO SCREEN POSSIBLE
80 PRINT " Press <RETURN> to start your Apple up. To quit the typewriter, hit <Control>-Q.": CALL -678: IF OTH=1 THEN GOTO 130
90 HOME
100 PRINT CHR$(4);"PR#1" : PRINT CHR$(4);"PR#A$C307"
110 GET TYP$: IF TYP$= CHR$(17) THEN GOTO 200
120 PRINT TYP$;: GOTO 110
130 REM WITHOUT PRINTING TO SCREEN
140 HOME
150 GET TYP$: IF TYP$= CHR$(17) THEN GOTO 200
160 PRINT TYP$;: PRINT CHR$(4)"PR#1": PRINT TYP$;: PRINT CHR$(4);"PR#A$C307"
170 PRINT CHR$(4);"PR#0" : GOTO 150
200 REM QUITING
210 PRINT CHR$(4);"PR#0": INVERSE: PRINT SPC(36);"THE END" :NORMAL:END
End of listing.
Things to implement yourself
----------------------------
If you want Near Letter Quality (NLQ) printing, then verify that your printer is capable and initialised for this. Alternatively, you may like to add it to the above program by inserting the right command.
Another addition you may like to add is word wrap. If a word will not fit on a horizontal line then, instead of hyphenating it, output the whole word on the next line.
Currently I have not been able to print each character as it is typed (like a real typewriter) because this involves switching between the screen and the printer after each character. Does anyone have any knowledge regarding an alternative to the below program which would fix this problem?
Now you have an 'almost' typewriter from your apple which should fulfill most needs. I doubt it would satisfy Betty 'brain-buster' of 'Hey Dad!' though - no lift-off!

THIS CONTENT COPYRIGHT © 2007, APPLE MACINTOSH USERS' GROUP, SYDNEY
Permission has been obtained to make this material available on the Internet.

Permission is hereby granted for non-profit user groups to republish this content.
PLEASE CREDIT THE AUTHOR AND THE SOURCE: Applecations, publication of the Apple Users' Group, Sydney, Australia

THIS PAGE COPYRIGHT © 2007, ANDREW ROUGHAN